Repository navigation
CI: install the pinned YAML parser so the isolated Bot Social overlay contract cannot be skipped - #3443
Conversation
tests/test_isolated_bot_social.py guarded the isolated Bot Social overlay contract behind `try: import yaml ... @skipUnless(yaml, ...)`, and no workflow ever installed PyYAML. In CI the whole contract class was skipped and the job still reported success, so the only assertion over deploy/isolated/ bot-social.compose.yml never ran. Install the pinned parser in the management job and drop the fallback: - tests/test_isolated_bot_social.py: hard `import yaml`, no skipUnless; a missing parser now fails the module at import time instead of skipping it. - .github/workflows/tests.yml: after setup-node and before the unittest step, `python -m pip install --disable-pip-version-check 'PyYAML==6.0.2'`. Both matrix versions (3.11, 3.13) have manylinux x86_64 wheels at this pin. - docs/RUNTIME_IMPLEMENTATION.md: "No pip/npm dependency install required" no longer held for the test suite; state the pin and that a missing parser fails rather than skips. - docs/COMPOSE_MANAGER.md: same install line in the repeatable acceptance block. 4 files, +15/-7. Local verification (not CI): base content with a parser-less interpreter gives `OK (skipped=1)` and exit 0; this patch on the same interpreter gives `ModuleNotFoundError: No module named 'yaml'` and exit 1; with PyYAML 6.0 the test passes, exit 0. Four mutations of the overlay (all-interfaces health port, extra exposed port, added networks block, bind mount instead of the named volume) each fail with a distinct message and exit 1; the unmutated overlay passes. Related #3442
Lead review — slice bound to head
|
| file | blob | lines |
|---|---|---|
.github/workflows/tests.yml |
112f7ff53fb2 |
+5/−0 |
docs/COMPOSE_MANAGER.md |
692c111242b6 |
+1/−0 |
docs/RUNTIME_IMPLEMENTATION.md |
91209ec0b586 |
+2/−1 |
tests/test_isolated_bot_social.py |
7576746409bf |
+7/−6 |
The slice does one thing: the isolated bot-social overlay contract is no longer allowed to be skipped. tests/test_isolated_bot_social.py drops the @unittest.skipUnless(yaml, …) guard and imports the parser directly; tests.yml installs the pinned parser in the management job before the unit tests run.
What I verified myself
Command and interpreter for each line below are named; these are local reads, not CI.
Content binding. On a pristine copy of 192e72fc, git apply --check on the patch → exit 0. Applying it and running git write-tree gives c94b6a1b, which is the head tree above. Reversing it returns the four files to the 192e72fc blobs ccf1d5e5 / 1571897161 / efa34fcc / eebabc2492.
Note on the diff headers: the patch's index 41d04e0..f937bda line for tests.yml names the pre-#3441 blob, because the patch was cut before 192e72fc landed. Three of the four index lines name current-main blobs, tests.yml does not. So the claim I record is "applies cleanly to 192e72fc and the result tree equals the head tree", not "all four index lines match main". The hunks are far apart: the ls/node --test guard sits at lines 32–33, the parser pin at 53–57.
Fail-closed A/B. Same module, two interpreters, base content and patched content:
| content | interpreter | result | exit |
|---|---|---|---|
192e72fc (base) |
no yaml (miniconda flybot) |
OK (skipped=1), skip reason PyYAML is required to parse the overlay |
0 |
| patched | no yaml (same interpreter) |
FAILED (errors=1), ModuleNotFoundError: No module named 'yaml' |
1 |
| patched | /usr/bin/python3, yaml 6.0 |
Ran 1 test, OK |
0 |
Row 1 is the hole this slice closes: on base, a runner without the parser reported success while the overlay contract never ran. Row 2 is the same interpreter after the change — it now fails at import, which is the intended direction.
Four overlay mutations against deploy/isolated/bot-social.compose.yml, each on its own copy, each exit 1 with a distinguishable message:
| mutation | message |
|---|---|
M1 bind 0.0.0.0:18783:8787 |
AssertionError: '0.0.0.0:18783' unexpectedly found in … |
M2 add exposed port 3320:3320 |
'3320' unexpectedly found |
M3 add a networks: block |
'networks' unexpectedly found in {'services': …} |
M4 named volume → ./bot-social-data:/data |
Lists differ: ['./bot-social-data:/data'] != ['bot-social-data:/data'] |
Unmutated overlay: OK, exit 0. Overlay restored byte-identical to base afterwards.
Pin. PyYAML==6.0.2 is installed with --disable-pip-version-check; the wheel exists for cp311 and cp313 manylinux x86_64, so the 3.11/3.13 matrix both resolve without building. Parsed with a YAML reader, the management job's steps are checkout → setup-python → setup-node → install the parser → unittest discover → compileall → --help, so the install lands before the tests and after node.
Cross-job reach. In the whole repo only tests.yml:63 runs unittest discover -s tests; upstream-migration.yml:21 runs the single module tests.test_upstream_migration, which does not import the new hard dependency. So no other job inherits it.
Why the two docs files are in the slice. docs/RUNTIME_IMPLEMENTATION.md states that no pip/npm dependency install is required. After this change that sentence is false for the management job, and leaving it would be a doc that contradicts the workflow. docs/COMPOSE_MANAGER.md gains the one line naming the parser requirement next to the overlay instructions. Both are consequences of the same change, not a separate topic.
Independent read. QA Engineer rebuilt the content from codeload tarballs for 192e72fc and 5e78db92, got the same trees f3b247f7 → c94b6a1b, the same +15/−7 numstat, 1/1 OK under yaml 6.0, the same fail-closed pair (skip / exit 0 on base, import error / exit 1 on head), and the same four mutation messages. QA reported that the diff-index line for tests.yml names the pre-#3441 blob — that is the correction recorded above, and it came from QA's read, not from mine. QA could not read refs/pull/3443/head (anonymous REST quota exhausted, github.com:443 unreachable from that host), so the sha identity here rests on my read of the ref; the content binding rests on two independent tree reconstructions that agree.
What this record does not claim
No parity, no acceptance, no user-facing verification. The overlay contract is checked against the file as written; nothing here says the deployed stack behaves as the overlay describes.
The risk tier on this PR was applied by the risk-gate workflow from the diff, not by hand. Per the 11-26 decision, tier is informational and not a merge gate; the decision to merge is mine, recorded here against head 5e78db92 and the tree above.
CI on this head
Read at 10:45Z against exactly 5e78db927e90c6eebf48a34d69e726474b125224: total_count 18, returned 18, all completed + success, every head_sha that sha. Nothing pending, nothing cancelled, nothing failed. Three workflow runs back it: FlyBot CI 46253326036, Risk tier label 46253326015, Silent revert 46253325928.
The part that matters is what the Management API job logs show, because a green check alone cannot tell you whether the overlay test ran or skipped:
| where | log line | result |
|---|---|---|
main 192e72fc, job 141315897631 (3.11) |
test_overlay_adds_only_bot_social_on_loopback … skipped 'PyYAML is required to parse the overlay' |
Ran 377 tests, OK (skipped=1) |
head 5e78db92, job 141316270132 (3.11) |
Successfully installed PyYAML-6.0.2, wheel cp311-cp311-manylinux_2_17_x86_64 |
Ran 377 tests, OK |
head 5e78db92, job 141316269897 (3.13) |
Successfully installed PyYAML-6.0.2, wheel cp313-cp313-manylinux_2_17_x86_64 |
Ran 377 tests, OK |
So on main today the CI reports success while the overlay contract is skipped; on this head the parser is installed as step 5 of the job (after setup-node, before the test step), the test count is unchanged at 377, and the skip is gone. That is the hole closed in CI, not only in a local reproduction. The green here is CI green on this head — not acceptance of the slice, and not a statement about the deployed overlay.
The new main after #3441 (192e72fc) is also fully green: total_count 33, returned 33, all completed + success, every head_sha that commit.
CI: install the pinned YAML parser so the isolated Bot Social overlay contract cannot be skipped
Related #3442
Problem
tests/test_isolated_bot_social.pyguards the isolated Bot Social overlay contract(
deploy/isolated/bot-social.compose.yml): additive to a Workspace Compose project, loopback-onlyhost binding, no extra published ports, no
networksblock, named volume only. It parsed theoverlay with PyYAML behind a fallback:
Nothing in
.github/workflows/ever installed PyYAML, so in CI the whole contract class wasskipped. The job reported success while the only assertion over that overlay never ran.
Measured on the base content (local, not CI), system/agent Python without PyYAML:
That is the defect: a missing dependency silently turned a contract check into a no-op.
Change
Fail closed instead of skipping, and pin the parser in the one job that runs the Python suite.
tests/test_isolated_bot_social.py: drop thetry/except ImportErrorfallback and theskipUnlessdecorator;import yamlunconditionally. A missing parser now fails the module atimport time. The docstring records why PyYAML is a hard requirement and where CI installs it.
.github/workflows/tests.yml: in themanagementjob, afteractions/setup-nodeand before thePython tests with explicit trusted runner Nodestep, addpython -m pip install --disable-pip-version-check 'PyYAML==6.0.2'. Comment states the intent:the dependency is pinned rather than skipped, a missing parser must fail this job, and both
matrix versions have manylinux x86_64 wheels at this pin.
docs/RUNTIME_IMPLEMENTATION.md: the old sentence "No pip/npm dependency install required." wasno longer true for the test suite. It now says the manager and server still need no pip/npm
install, the suite additionally parses the overlay with PyYAML 6.0.2, a missing parser fails
rather than skips, and the run block gains the install line.
docs/COMPOSE_MANAGER.md: the repeatable-acceptance block gains the same install line beforeunittest discover, so a reviewer reproducing locally does not hit the skip again.Size: 4 files, +15/−7.
Fail-closed A/B (local, not CI)
Same test module, same content, only the interpreter's PyYAML availability differs.
Ran 1 test/OK (skipped=1)ImportError: Failed to import test module: test_isolated_bot_social/ModuleNotFoundError: No module named 'yaml'/FAILED (errors=1)python3with PyYAML 6.0Ran 1 test in 0.003s/OKpython3 -m unittest discover -s tests -p "test_isolated_bot_social.py"gives the same results, sothe failure is not an artefact of naming the module directly.
The contract actually bites
Four mutations of
deploy/isolated/bot-social.compose.yml, applied to this patch, each revertedafter measuring. All four fail the test with distinct messages (local, not CI):
127.0.0.1:...→0.0.0.0:...Lists differ: ['0.0.0.0:${FLYBOT_WORKSPACE_BOT_SOCIAL_HEALTH_PORT:-18783}:8787'] != ['127.0.0.1:...']"3320"toexpose'3320' unexpectedly found in ...networks: {default: {driver: bridge}}'networks' unexpectedly found in {...}volumes: bot-social-data:/datawith./data:/dataLists differ: ['./data:/data'] != ['bot-social-data:/data']Unmutated overlay on the same tree: exit 0. So the test is not merely fail-closed; it still
discriminates the four properties it claims to check.
Pin evidence
PyYAML==6.0.2is reachable and has wheels for both matrix versions:pip download --no-deps --only-binary=:all: PyYAML==6.0.2succeeds.PyYAML-6.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whland the correspondingcp313wheel (53 files total).pip install --dry-run 'PyYAML==6.0.2'reportsWould install PyYAML-6.0.2.The job uses
python -m pipon the interpreter thatactions/setup-pythonjust selected, so bothmatrix entries (
3.11,3.13) install from the same pin.Scope of the change
.github/workflows/contains exactly two Python entry points.tests.ymlis the only workflowthat runs
unittest discoverand therefore the only one that could reach the overlay test.upstream-migration.ymlrunspython3 -m unittest tests.test_upstream_migration -v, a singleunrelated module, so it needs no parser.
import yamloccurs in exactly one file in the repository, the test module changed here.Verification
All numbers above are local. CI has not run this branch at the time of writing, so this is not a
claim of a green pipeline; the job has to prove the pin installs and the contract runs on both
matrix versions.
Non-goals
managementjob.Rollback
Revert the commit. That restores the
skipUnlessfallback, which brings the silent skip back; theoverlay contract would again be unverified in CI. If the pin is what needs reverting rather than
the fail-closed part, move the requirement to
constraints.txt-style pinning later, but keep thehard import: the skip is the defect, not the pin.